
function datestring(date) {
  var res = `${date.getFullYear()}-${date.getMonth()+1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
  return res;
}

function randname() {
  let str = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  let randomStr = '';
  for (let i = 17; i > 0; --i) {
    randomStr += str[Math.floor(Math.random() * str.length)];
  }
  var date = new Date();
  return randomStr + (date.getMonth() + 1) + '-' + date.getDate();
}

module.exports = {
    datestring: datestring,
    randname: randname,
}
